package com.shixun.dds_11.controller;


import com.shixun.dds_11.context.BaseContext;
import com.shixun.dds_11.dto.GoodsPageDTO;
import com.shixun.dds_11.entity.DdsGoods;
import com.shixun.dds_11.entity.DdsNote;
import com.shixun.dds_11.result.PageResult;
import com.shixun.dds_11.result.Result;
import com.shixun.dds_11.service.IDdsGoodsService;
import com.shixun.dds_11.service.IDdsNoteService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author YSP
 * @since 2024-07-05
 */
@RestController
@RequestMapping("/dds11/goods")
@Api(tags = "商品接口")
@CrossOrigin
@Slf4j
public class DdsGoodsController {

    @Autowired
    IDdsGoodsService iDdsGoodsService;


    @GetMapping("/list")
    @ApiOperation("商品条件分页查询")
    public Result<PageResult> list(GoodsPageDTO goodsPageDTO){
        log.info("商品条件分页查询");
        PageResult pageResult =iDdsGoodsService.pageQuery(goodsPageDTO);
        return Result.success(pageResult);
    }

    @GetMapping("/{id}")
    @ApiOperation("商品详情查询")
    public Result<DdsGoods> getById(@PathVariable Integer id){
        log.info("商品详情查询");

        return Result.success(iDdsGoodsService.getBygoodsId(id));
    }


}
